<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/framework/tcp/ClassFactory.cpp 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_5752cadd8276ecfd63d9b924f2a4d4b5.html">framework</a></li><li class="navelem"><a class="el" href="dir_c67741c6509c9bd4aec6faa9fd694608.html">tcp</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">ClassFactory.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_class_factory_8cpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &quot;../../socket/internal/IoPortService.h&quot;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &quot;../../socket/TcpIoServer.h&quot;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;../../socket/TcpIoSocket.h&quot;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;../../socket/Timer.h&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_class_factory_8h.html">ClassFactory.h</a>&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_client_8h.html">./framework/Client.h</a>&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_server_8h.html">./framework/Server.h</a>&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160; </div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="class_server_factory.html#aee6cb1d71fc56ecb7b69a285b4eb8f09">   11</a></span>&#160;<a class="code" href="class_service.html">Service</a>* <a class="code" href="class_server_factory.html#aee6cb1d71fc56ecb7b69a285b4eb8f09">ServerFactory::GetServer</a>() {</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;    <span class="keywordflow">return</span> dynamic_cast&lt;Service*&gt;(<span class="keyword">new</span> <a class="code" href="class_server.html">Server</a>());</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;}</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="class_server_factory.html#a6a830d59f1d7bf02571b6f5a5c88dbe1">   16</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_server_factory.html#a6a830d59f1d7bf02571b6f5a5c88dbe1">ServerFactory::ReleaseServer</a>(<a class="code" href="class_service.html">Service</a>* s) {</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keyword">delete</span> dynamic_cast&lt;Server*&gt;(s);</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;}</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="a_server_8h_html"><div class="ttname"><a href="_server_8h.html">Server.h</a></div></div>
<div class="ttc" id="aclass_server_html"><div class="ttname"><a href="class_server.html">Server</a></div><div class="ttdef"><b>Definition:</b> <a href="_server_8h_source.html#l00013">Server.h:13</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="aclass_service_html"><div class="ttname"><a href="class_service.html">Service</a></div><div class="ttdoc">服务基类</div><div class="ttdef"><b>Definition:</b> <a href="_service_8h_source.html#l00019">Service.h:19</a></div></div>
<div class="ttc" id="a_class_factory_8h_html"><div class="ttname"><a href="_class_factory_8h.html">ClassFactory.h</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="a_client_8h_html"><div class="ttname"><a href="_client_8h.html">Client.h</a></div></div>
<div class="ttc" id="aclass_server_factory_html_a6a830d59f1d7bf02571b6f5a5c88dbe1"><div class="ttname"><a href="class_server_factory.html#a6a830d59f1d7bf02571b6f5a5c88dbe1">ServerFactory::ReleaseServer</a></div><div class="ttdeci">virtual void ReleaseServer(Service *s)</div><div class="ttdoc">回收一个server,默认delete Server</div><div class="ttdef"><b>Definition:</b> <a href="_class_factory_8cpp_source.html#l00016">ClassFactory.cpp:16</a></div></div>
<div class="ttc" id="aclass_server_factory_html_aee6cb1d71fc56ecb7b69a285b4eb8f09"><div class="ttname"><a href="class_server_factory.html#aee6cb1d71fc56ecb7b69a285b4eb8f09">ServerFactory::GetServer</a></div><div class="ttdeci">virtual Service * GetServer()</div><div class="ttdoc">生产一个server,默认使用new Server</div><div class="ttdef"><b>Definition:</b> <a href="_class_factory_8cpp_source.html#l00011">ClassFactory.cpp:11</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
